<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('宿舍列表')" />
	<th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="gray-bg">
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>


							<li>校区名称： <select name="schoolId"
								class="selectpicker show-tick " data-live-search="true"
								data-none-selected-text="请选择">
									<option></option>
									<option></option>
									<option id="schoolId" th:each="school:${schoolList}"
										th:value="${school.id}" th:text="${school.schoolName}"></option>
							</select>
							</li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li></li>
							<li>宿舍名称：<input type="text" name="dormName" />
							</li>



							<li><a class="btn btn-primary btn-rounded btn-sm"
								onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm"
								onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
	        <div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-success" onclick="dormAdd()" shiro:hasPermission="Dorm:dorm:add">
					<i class="fa fa-plus"></i> 添加宿舍
				</a>
				
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <th:block th:include="include :: bootstrap-select-js" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('Dorm:dorm:edit')}]];
        var removeFlag = [[${@permission.hasPermi('Dorm:dorm:remove')}]];
        var prefix = ctx + "Dorm/dorm";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
				exportUrl: prefix + "/export",
                modalName: "宿舍",
		        showExport: true,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'id', 
					title : '主键',
					visible: false
				},
				{
					field : 'schoolName', 
					title : '校区名称',
					sortable: true
				},
				{
					field : 'dormName', 
					title : '宿舍名称',
					sortable: true
				},
			
				{
					field : 'createDate', 
					title : '建立时间',
					sortable: true
				},
				
		
				
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="dormUpdate(\'' + row.id + '\')"><i class="fa fa-edit"></i>宿舍详情</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
        
        function dormUpdate(id) {
        	$.modal.open('编辑商品', prefix + "/edit/" + id, '1300', '500');			
		}
        
        function dormAdd() {
        	$.modal.open('添加商品', prefix + "/add/", '1300', '500');			
		}
    </script>
</body>
</html>